package com.djnt.catering;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.MarshalBase64;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import com.djnt.catering.web.HttpServer;
import com.djnt.catering.web.Register;

import android.app.Activity;
import android.content.ContentValues;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

public class UserRegisterActivity extends Activity {

	protected static final String TAG = "MainManagerUserActivity";
	private SharedPreferences mSettings;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.user_register);
		mSettings = PreferenceManager.getDefaultSharedPreferences(this);

	}

	public void onRegister(View view) {
		// TODO Auto-generated method stub
		ContentValues cv = new ContentValues();
		RadioGroup type = (RadioGroup) this.findViewById(R.id.user_type);
		int type1 = Settings.UserType.PERSON;
		if (type.getCheckedRadioButtonId() == R.id.user_type_company) {
			type1 = Settings.UserType.COMPANY;
		}
		EditText username = (EditText) this.findViewById(R.id.username);
		EditText password = (EditText) this.findViewById(R.id.password);
		EditText password2 = (EditText) this.findViewById(R.id.password2);
		EditText email = (EditText) this.findViewById(R.id.email);
		EditText phone = (EditText) this.findViewById(R.id.phone);

		Register r = new Register(new Handler() {

			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
			}
		});
		r.put(Register.USERNAME, username.getText().toString());
		r.put(Register.PASSWORD, password.getText().toString());
		//r.put(Register.EMAIL, email.getText().toString());
		//r.put(Register.PHONE, phone.getText().toString());
		r.start();
	}
}
